package util;

import logic.Line;
import logic.PointD;

public class Util {
	public static double getDist(double x1, double y1, double x2, double y2)
	{
		double dx = x2 - x1;
		double dy = y2 - y1;
		return Math.sqrt((dx * dx) + (dy * dy));
	}
	
	public static double detDist(PointD p1, PointD p2)
	{
		double dx = p2.getX() - p1.getX();
		double dy = p2.getY() - p1.getY();
		return Math.sqrt((dx * dx) + (dy * dy));
	}
	
	public static double lerpY(double x1, double y1, double x2, double y2, double x)
	{
		return y1 + ((x - x1) / (x2 - x1)) * (y2 - y1);
	}
	
	public static double lerpY(PointD p1, PointD p2, double x)
	{
		return lerpY(p1.getX(), p1.getY(), p2.getX(), p2.getY(), x);
	}
}
